import prisma from '@/server/lib/prisma';

export default defineEventHandler(async () => {
  try {
    const result = await prisma.sys_dept.findMany({
      orderBy: {
        orderNum: 'asc'
      }
    })
    return {
      code: 200,
      data: result,
    }
  } catch (e) {
    throw e;
  } finally {
    await prisma.$disconnect(); // 关闭连接
  }
})